package com.cy.uv.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cy.uv.entity.Merchant;
import com.cy.uv.mapper.MerchantMapper;
import com.cy.uv.service.MerchantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

;
import java.util.List;


@Service
public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> implements MerchantService {
    @Autowired
    MerchantMapper merchantMapper;

    @Override
    public List<Merchant> getMerchantByName(String name) {
        QueryWrapper<Merchant> queryWrapper = new QueryWrapper<>();
        queryWrapper.like("name", name);
        return list(queryWrapper);
    }

    @Override
    public List<Merchant> getMerchantBySort(String sort) {
        QueryWrapper<Merchant> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("sort", sort);
        return list(queryWrapper);
    }

    @Override
    public List<Merchant> getMerchantByStatus(Integer status) {
        QueryWrapper<Merchant> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("status", status);
        return list(queryWrapper);
    }

    @Override
    public List<Merchant> getMerchantByType(Integer type) {
        QueryWrapper<Merchant> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("type", type);
        return list(queryWrapper);
    }

   /* @Override
    public Integer updatestaus(Integer status, String name) {
        List<Merchant> merchant;
        merchant = getMerchantByName(name);
        merchantMapper.update( );
        return
    }*/
}
